package zuoye08;

import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class zuoye05 {
     public static void main(String[] args) throws IOException {
         BufferedReader count=new BufferedReader(new FileReader("count.txt"));
         int num=Integer.parseInt(count.readLine());
         FileReader fr=new FileReader("names.txt");
         BufferedReader br=new BufferedReader(fr);
         String read=br.readLine();
         ArrayList<String> arr=new ArrayList<>();
         while (read!=null) {
             arr.add(read);
             read=br.readLine();
         }
         Collections.sort(arr);
         //System.out.println(arr);
         Random rd=new Random();
         int c=rd.nextInt(arr.size());
         String n=arr.get(c).split("-")[0];
         FileWriter fw1=new FileWriter("count.txt");
         BufferedReader count1=new BufferedReader(new FileReader("count1"));
         System.out.println(arr);
         int num1=Integer.parseInt(count1.readLine());
             fw1.write(Integer.toString(num + 1));
             if(num==3)
             {
                 num1=c;
                 System.out.println(num1);
                 FileWriter fw2=new FileWriter("count1");
                 fw2.write(Integer.toString(num1));
                 fw2.close();
             }
             if(num%3==0&&num!=3)
             {
                 n = arr.get(num1).split("-")[0];
             }
         System.out.println("第"+num+"点名"+n);
         fr.close();
         fw1.close();
         count.close();
     count1.close();
     }
}
